#ifndef __TRANSACTION_H__
#define __TRANSACTION_H__

#include <string>
#include "stock.h"
#include "date.h"
#include "time.h"

namespace stock_trade{

enum TYPE   {UP, DOWN, NORMAL};
enum STATUS {SUBMIT, SUCCESS, FAILED};
enum ACTION {NONE, BUY, SELL};

class Transaction{
public:
    Transaction(){} 
    Transaction(std::string code, 
                std::string name,
                Date date,
                Time time,
                float price,
                int number,
                TYPE type = NORMAL,
                STATUS status = FAILED,
                ACTION action = NONE):stock(code, name), 
                              date(date), 
                              time(time), 
                              price(price), 
                              number(number), 
                              type(type), 
                              status(status),
                              action(action){}
    Stock stock;
    Date date;
    Time time;
    float price;
    int number;
    TYPE type;
    STATUS status;
    ACTION action;
    bool operator<(const Transaction& transaction) const;
    std::string ToString() const;
};
}
#endif
